package com.seal.yoyoshop.web;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "LogoutServlet", value = "/index/logout")
public class LogoutServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        删掉session里的user
        HttpSession session = request.getSession();
        session.removeAttribute("user");
        session.removeAttribute("order");
//        请求转发
//        request.getRequestDispatcher("/index/index").forward(request,response);
//        重定向
        response.sendRedirect("/yoyoshop_war_exploded/index/index");
    }
}
